import Taro, { Component } from '@tarojs/taro'
import { View, Text, Picker } from '@tarojs/components'
import './orderrecord.css'
import { AtAccordion, AtList, AtListItem, AtCalendar } from 'taro-ui'
import reactMixin from 'react-mixin';
import myJs from './orderrecordJs.js'
import app from '../../../../main.js'

export default class OrderRecord extends Component {

  config = {
    navigationBarTitleText: '订单记录'
  }
  constructor() {
    super(...arguments);
    this.state = this.getData();
  }

  init() {
    this.setState({
      open: true,
      open2: true,
      dateSel: '2018-09'
    })
  }

  go(id,type) {
    app.navigateTo('../orderdetails/orderdetails?id='+id+'&type='+type)
  }


  render() {
    return (
      <View className='order-record'>
        <AtList>
          {
            this.state.inquiry_orders.items.map((item, index) => {
              return (
                <AtListItem
                  key={index}
                  onClick={this.go.bind(this,item.id,item.order_type)}
                  title={item.patientName + " " + item.order_type}
                  note={item.created_at}
                  extraText={item.status + ' ￥' + item.totalprice} />
              )
            })
          }
        </AtList>
      </View>
    )
  }
}
reactMixin.onClass(OrderRecord, myJs);
